package cn.edu.zucc.controller;

import cn.edu.zucc.entity.EduExp;
import cn.edu.zucc.service.BaseService;
import cn.edu.zucc.service.EduExpService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @description edu_exp
 * @author zhengkai.blog.csdn.net
 * @date 2022-04-13
 */
//@CrossOrigin
//@RestController
//@RequestMapping(value = "/eduExp")
public class EduExpController extends BaseController<EduExp>{

    @Resource
    private EduExpService eduExpService;

//    @Override
//    public void setBaseService(BaseService<EduExp> baseService) {
//        super.setBaseService(baseService);
//    }

    /**
     * 新增
     * @author zhengkai.blog.csdn.net
     * @date 2022/04/13
     **/
//    @PostMapping("/insert")
//    public Object insert(EduExp eduExp){
//        return eduExpService.insert(eduExp);
//    }

    /**
     * id 存在就更新 不然插入
     * @param eduExp
     * @return
     */
//    @PostMapping("/save")
//    public Object save(@RequestBody  EduExp eduExp){
//        return eduExpService.save(eduExp);
//    }

    /**
     * 刪除
     * @author zhengkai.blog.csdn.net
     * @date 2022/04/13
     **/
    @PostMapping("/delete")
    public Object delete(int id){
        return eduExpService.delete(id);
    }

    /**
     * 更新
     * @author zhengkai.blog.csdn.net
     * @date 2022/04/13
     **/
    @PostMapping("/update")
    public Object update(EduExp eduExp){
        return eduExpService.update(eduExp);
    }

    /**
     * 查询 根据主键 id 查询
     * @author zhengkai.blog.csdn.net
     * @date 2022/04/13
     **/
    @PostMapping("/load")
    public Object load(int id){
        return eduExpService.load(id);
    }

    /**
     * 查询 分页查询
     * @author zhengkai.blog.csdn.net
     * @date 2022/04/13
     **/
    @PostMapping("/list")
    public Map<String, Object> pageList(@RequestParam(required = false, defaultValue = "0") int pageNumber,
                                        @RequestParam(required = false, defaultValue = "10") int pageSize) {
        return eduExpService.pageList(pageNumber, pageSize);
    }

}
